package com.baiyu.scerp.supplier.service.impl;

import java.util.List;
import com.baiyu.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baiyu.scerp.supplier.mapper.ScSupplierMapper;
import com.baiyu.scerp.supplier.domain.ScSupplier;
import com.baiyu.scerp.supplier.service.IScSupplierService;
import com.baiyu.common.core.text.Convert;

/**
 * 供应商Service业务层处理
 * 
 * @author wph
 * @date 2025-08-15
 */
@Service
public class ScSupplierServiceImpl implements IScSupplierService 
{
    @Autowired
    private ScSupplierMapper scSupplierMapper;

    /**
     * 查询供应商
     * 
     * @param supplierId 供应商主键
     * @return 供应商
     */
    @Override
    public ScSupplier selectScSupplierBySupplierId(Long supplierId)
    {
        return scSupplierMapper.selectScSupplierBySupplierId(supplierId);
    }

    /**
     * 查询供应商列表
     * 
     * @param scSupplier 供应商
     * @return 供应商
     */
    @Override
    public List<ScSupplier> selectScSupplierList(ScSupplier scSupplier)
    {
        return scSupplierMapper.selectScSupplierList(scSupplier);
    }

    /**
     * 新增供应商
     * 
     * @param scSupplier 供应商
     * @return 结果
     */
    @Override
    public int insertScSupplier(ScSupplier scSupplier)
    {
        scSupplier.setCreateTime(DateUtils.getNowDate());
        return scSupplierMapper.insertScSupplier(scSupplier);
    }

    /**
     * 修改供应商
     * 
     * @param scSupplier 供应商
     * @return 结果
     */
    @Override
    public int updateScSupplier(ScSupplier scSupplier)
    {
        scSupplier.setUpdateTime(DateUtils.getNowDate());
        return scSupplierMapper.updateScSupplier(scSupplier);
    }

    /**
     * 批量删除供应商
     * 
     * @param supplierIds 需要删除的供应商主键
     * @return 结果
     */
    @Override
    public int deleteScSupplierBySupplierIds(String supplierIds)
    {
        return scSupplierMapper.deleteScSupplierBySupplierIds(Convert.toStrArray(supplierIds));
    }

    /**
     * 删除供应商信息
     * 
     * @param supplierId 供应商主键
     * @return 结果
     */
    @Override
    public int deleteScSupplierBySupplierId(Long supplierId)
    {
        return scSupplierMapper.deleteScSupplierBySupplierId(supplierId);
    }
}
